]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Keep cleanup symmetrical with prepare in ease functions
authorJoan Torres Lopez <joantolo@redhat.com>
Wed, 25 Feb 2026 13:19:41 +0000 (14:19 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 2 Aug 2026 16:53:54 +0000 (18:53 +0200)
Add a guard to prevent cleanup() from running when prepare() was never
called. Currently cleanup() is called when "stopped" is emitted (which
ensures prepare() was called), in next commits cleanup will be called
from different events which means prepare() may not have been called.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4082>
(cherry picked from commit 841ff6cfa247e69ed2c466c880846d1cceb3eece)

js/ui/environment.js

index 45dafa9a7b4c747188827b291b8247c853b195e2..0e0ab2f339e2f5f1ebc2cbe966b4a85fb4b7bcd0 100644 (file)
@@ -85,11 +85,15 @@ function _makeEasePrepareAndCleanup(duration) {
     if (!duration)
         return {prepare: null, cleanup: null};
 
+    let canCleanup = false;
     const prepare = () => {
         global.compositor.disable_unredirect();
         global.begin_work();
+        canCleanup = true;
     };
     const cleanup = () => {
+        if (!canCleanup)
+            return;
         global.compositor.enable_unredirect();
         global.end_work();
     };